package com.zycfc.zsf.boot.logback.core;

import java.io.*;
import com.zycfc.zsf.boot.util.net.*;
import com.zycfc.zsf.boot.logback.consts.*;

public class SqlLogInf implements Serializable
{
    private static final long serialVersionUID = 1L;
    private String sqlId;
    private String sqlName;
    private String sqlClassPath;
    private String sqlMethod;
    private String sqlCommandType;
    private String datasourceType;
    private String sql;
    private long exeTm;
    private String exeIp;
    private String exeSts;
    private String sqlParamJson;
    private String respCode;
    private String respMsg;
    private Integer totalCount;
    
    public SqlLogInf(final String sqlId, final String sqlCommandType, final String datasourceType, final String sql, final long exeTm) {
        this.exeSts = "S";
        this.sqlId = sqlId;
        this.sqlCommandType = sqlCommandType;
        this.datasourceType = datasourceType;
        this.sql = sql;
        this.exeTm = exeTm;
        this.exeIp = NetUtils.getLocalHostIp();
    }
    
    public SqlLogInf(final SqlLogInfBuilder builder) {
        this.exeSts = "S";
        this.sqlId = builder.getSqlId();
        this.sqlName = builder.getSqlName();
        this.sqlClassPath = builder.getSqlClassPath();
        this.sqlMethod = builder.getSqlMethod();
        this.sqlCommandType = builder.getSqlCommandType();
        this.datasourceType = builder.getDatasourceType();
        this.sql = builder.getSql();
        this.sqlParamJson = builder.getSqlParamJson();
        this.exeTm = builder.getExeTm();
        this.exeSts = builder.getExeSts();
        this.respCode = builder.getRespCode();
        this.respMsg = builder.getRespMsg();
        this.exeIp = NetUtils.getLocalHostIp();
        this.totalCount = builder.getTotalCount();
    }
    
    @Override
    public String toString() {
        return LogTypeEnum.SQL + "@@@" + this.sqlCommandType + "#@%@#" + this.sqlName + "#@%@#" + this.datasourceType + "#@%@#" + this.sqlClassPath + "#@%@#" + this.sqlMethod + "#@%@#" + this.sqlId + "#@%@#" + this.sql + "#@%@#" + this.sqlParamJson + "#@%@#" + this.exeIp + "#@%@#" + this.exeTm + "#@%@#" + this.exeSts + "#@%@#" + this.respCode + "#@%@#" + this.respMsg + "#@%@#" + this.totalCount;
    }
    
    public void setSqlId(final String sqlId) {
        this.sqlId = sqlId;
    }
    
    public void setSqlName(final String sqlName) {
        this.sqlName = sqlName;
    }
    
    public void setSqlClassPath(final String sqlClassPath) {
        this.sqlClassPath = sqlClassPath;
    }
    
    public void setSqlMethod(final String sqlMethod) {
        this.sqlMethod = sqlMethod;
    }
    
    public void setSqlCommandType(final String sqlCommandType) {
        this.sqlCommandType = sqlCommandType;
    }
    
    public void setDatasourceType(final String datasourceType) {
        this.datasourceType = datasourceType;
    }
    
    public void setSql(final String sql) {
        this.sql = sql;
    }
    
    public void setExeTm(final long exeTm) {
        this.exeTm = exeTm;
    }
    
    public void setExeIp(final String exeIp) {
        this.exeIp = exeIp;
    }
    
    public void setExeSts(final String exeSts) {
        this.exeSts = exeSts;
    }
    
    public void setSqlParamJson(final String sqlParamJson) {
        this.sqlParamJson = sqlParamJson;
    }
    
    public void setRespCode(final String respCode) {
        this.respCode = respCode;
    }
    
    public void setRespMsg(final String respMsg) {
        this.respMsg = respMsg;
    }
    
    public void setTotalCount(final Integer totalCount) {
        this.totalCount = totalCount;
    }
    
    public String getSqlId() {
        return this.sqlId;
    }
    
    public String getSqlName() {
        return this.sqlName;
    }
    
    public String getSqlClassPath() {
        return this.sqlClassPath;
    }
    
    public String getSqlMethod() {
        return this.sqlMethod;
    }
    
    public String getSqlCommandType() {
        return this.sqlCommandType;
    }
    
    public String getDatasourceType() {
        return this.datasourceType;
    }
    
    public String getSql() {
        return this.sql;
    }
    
    public long getExeTm() {
        return this.exeTm;
    }
    
    public String getExeIp() {
        return this.exeIp;
    }
    
    public String getExeSts() {
        return this.exeSts;
    }
    
    public String getSqlParamJson() {
        return this.sqlParamJson;
    }
    
    public String getRespCode() {
        return this.respCode;
    }
    
    public String getRespMsg() {
        return this.respMsg;
    }
    
    public Integer getTotalCount() {
        return this.totalCount;
    }
}
